Skip to content

Exec JSONL driver: foreground subagent ownership, held-call interruption, bounds, correlation and secret-safe errors - #139

Merged
leonardoaraujosantos merged 5 commits into
mainfrom
feat/exec-stream-ownership
Nov 18, 2026
Merged

leonardoaraujosantos merged 5 commits into
mainfrom
feat/exec-stream-ownership

Conversation

@leonardoaraujosantos

Copy link
Copy Markdown
Contributor

Advances #93. Stacked on #123 (feat/managed-recovery-owner); retarget to main once #123 merges.

Closes the remaining local gaps in complete-daily-coding-surfaces tasks 5.4 and 6.2–6.4 (structured I/O / JSONL driver).

Changes

Foreground subagent ownership (6.2/6.4)

  • A foreground (synchronous) agent call lends its dispatched call's complete recorded input cohort to its child while it waits, in this server process (runtime/foreground_children.rs, JobAdmission::lend_foreground). descendant_inputs::recorded accepts that live link beside running background Jobs; when both prove a link they must agree. A restart drops the link, so nothing is stamped afterwards.
  • No driver change needed: the child's requests carry root_session_id/root_input_message_ids, so they are claimed, answered over stdin, invisible to and unanswerable by a second driver, and settled on EOF.

Acknowledged interruption with a held call (6.2)

  • A subtree stop withdraws waiting requests (best effort, bounded) before it cancels actors. Permission and question waits now prefer a reply that was already delivered over a later cancellation, so a call held at its request settles as refused (never run) and the scoped interruption is acknowledged. An approval that arrives together with a cancellation still aborts the call. A tool call that is actually running when cancelled still reports unknown.
  • Bug fix with regression test interrupt_stops_an_owned_subagent_awaiting_permission. Before this change it ended with "Input interruption could not be reconciled".
  • Foreground case: the interruption is acknowledged, the child stops without running its withheld call, and later input still runs. The parent's cancelled agent call settles as outcome_unknown, because a call cancelled while its child ran cannot prove the child's effects. The spec now says this.

Resource bounds and correlation (6.2)

  • The driver tracks at most 64 owned requests. A further one is declined at once and gets a non-fatal error line with code capacity. At most 16 parsed stdin lines are buffered, down from 64.
  • Step lines (assistant_text, reasoning, tool_use, tool_result, permission_denied, retry, text_delta, reasoning_delta, usage_limit, and the error of a failed step) now carry input_message_ids.

Secret-safe errors (6.3)

  • Error and message fields now also apply the configured tool_output.redact patterns and allow list, plus the exact values of known secrets: secret-named environment variables, secret config entries and --password. Built-in detectors stay on even with enabled: false. The same policy covers the --format json result error and the error: lines printed in text mode.
  • Still open: the server records the raw provider message in session.step.failed.

Spec/docs: exec-mode delta scenarios, docs/local-core-guide.md, docs/features.md and task notes are updated. The root_session_id doc comment changed, so OpenAPI and the SDK were regenerated. Tasks 5.4 and 6.2–6.4 are ticked on local evidence; native platform acceptance remains under 7.2.

Tests

  • New real-binary tests: foreground permission answered over stdin, EOF settling a foreground question, a second driver isolated from a foreground request, foreground interruption, a background subagent awaiting permission (interruption acknowledged), step-line correlation, and configured-pattern/known-secret redaction. The first three and the redaction test fail without the change.
  • New unit tests: foreground links and the link agreement rule, the owned-request bound, and error_redactor.
  • Runs (nextest ci): exec_stream_input (41), the exec delegation, lifecycle-hook, owned-job, output-schema and untrusted suites (88 in total), exec unit tests (43), cyber-server lib plus the subtree/interrupt/input-client/structured/HTTP suites (645), and the cyber-tools agent suites (46).
  • Gates: cargo fmt --check, workspace clippy -D warnings, openspec validate --all --strict, spec_lint (0 errors), spec_inventory --check, OpenAPI current, cyber help-markdown equal to docs/cli.md. The SDK typecheck was not run; only a generated doc comment changed.

Decisions

  • No reconnect across a server restart (owner decision 2026-11-15) is unchanged.
  • Making a foreground agent call settle as a known outcome on interruption would need the tool to prove its child's effects. That is not done here; if wanted, it needs an owner decision.

…subtree stop

A foreground agent call now lends its dispatched call's complete recorded
input cohort to its child while it waits for it in this server process, so
the child's requests carry root_session_id/root_input_message_ids like a
background Job's. Running Jobs and the live call must agree on one link; a
restart drops the link.

A subtree stop now withdraws waiting requests before cancelling actors, and
permission/question waits prefer an already delivered refusal over a later
cancellation, so a call held at its request settles as refused instead of
outcome_unknown and the stop can be acknowledged. An approval meeting a
cancellation still aborts.
…ets in exec errors

- At most 64 owned requests are tracked; a further one is declined at once
  with a non-fatal capacity error line. At most 16 parsed stdin lines wait.
- Lines a driven step writes carry that step's input_message_ids.
- Error fields use the configured tool_output.redact patterns and allow
  list plus known env/config secrets and the attach password, with built-in
  detectors always on; also for the json result and text-mode error lines.

Real-binary coverage for foreground subagent ownership, EOF settlement,
second-driver isolation and interruption, and for interrupting a subagent
whose call awaits permission (regression: it reported unknown).
…tion in exec-mode spec and docs

Tick 5.4 and 6.2-6.4 locally; platform acceptance stays under 7.2.
…rship

# Conflicts:
#	crates/cyber-cli/src/commands/exec/driver.rs
#	docs/features.md
@leonardoaraujosantos
leonardoaraujosantos changed the base branch from feat/managed-recovery-owner to main November 17, 2026 20:20
@leonardoaraujosantos
leonardoaraujosantos merged commit 9678491 into main Nov 18, 2026
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant